package com.soft.service;

import com.soft.dao.EmpRecordDaoImpl;
import com.soft.pojo.Jianli;
import com.soft.utils.Result;

import java.util.ArrayList;

/**
 * @author ruoxi
 * @create 2021-12-27 11:10
 */
public class EmpRecordService {
    private EmpRecordDaoImpl empRecordDao = new EmpRecordDaoImpl();

    public int findEmpRecordCount() {
        return empRecordDao.selectByAll().size();
    }

    public ArrayList<Jianli> findEmpRecordByPage(int currentPage, int currentCount) {
        return (ArrayList<Jianli>) empRecordDao.selectEmpRecordByPage(currentPage, currentCount);
    }

    public ArrayList<Jianli> findEmpRecordCheckByPage(int currentPage, int currentCount) {
        return (ArrayList<Jianli>) empRecordDao.selectEmpRecordCheckByPage(currentPage, currentCount);
    }

    public Jianli findEmpRecordById(int id) {
        return empRecordDao.selectEmpRecordById(id).get(0);
    }

    public Result addEmpRecord(Jianli resume) {
        int line = empRecordDao.add(resume);
        if (line > 0) {
            return Result.me().setMsg("提交成功");
        }
        return Result.me(false).setMsg("提交失败");
    }

    public Result resumeCheckPass(int eno) {
        return null;
    }

    public Result resumeCheckFail(int id) {
        int line = empRecordDao.resumeCheckFail(id);
        if (line>0){
            return Result.me().setMsg("已拒绝");
        }
        return Result.me(false).setMsg("系统错误,拒绝失败");
    }


}
